<?php include_once('king_head.php');
if($action=="Save")
{
$addon_title=mysql_escape_string($addon_title);
$addon_desc=mysql_escape_string($addon_desc);
if($slot1=="")$slot1=0;
if($pr_inc1=="")$pr_inc1=0;
if($slot2=="")$slot2=0;
if($pr_inc2=="")$pr_inc2=0;
if($slot3=="")$slot3=0;
if($pr_inc3=="")$pr_inc3=0;
if($slot4=="")$slot4=0;
if($pr_inc4=="")$pr_inc4=0;
if($slot5=="")$slot5=0;
if($pr_inc5=="")$pr_inc5=0;
if($slot6=="")$slot6=0;
if($pr_inc6=="")$pr_inc6=0;

$q1="INSERT INTO product_addon(product_id, addon_title, addon_desc, slot1, pr_inc1, slot2, pr_inc2, slot3, pr_inc3, slot4, pr_inc4, slot5, pr_inc5, slot6, pr_inc6) values($product_id, '$addon_title', '$addon_desc', $slot1, $pr_inc1, $slot2, $pr_inc2, $slot3, $pr_inc3, $slot4, $pr_inc4, $slot5, $pr_inc5, $slot6, $pr_inc6)";
//echo $q1;
mysql_query($q1);
echo"<H4><font color='red'>Product Addon Added Successfully!!</font></H4>";
}
?>
                    <h1>Product Addons</h1>
					<form name="frm" method="post" > 
                    <table width="348" border="0">
                      <tr>
                        <td width="258"><div align="right">
                          Select an Addon 
                          <select name="addon_id">
						  <?php
						  $q2="select * from product_addon";
						  $r2=mysql_query($q2);
						  while($row2=mysql_fetch_array($r2))
						  {?>
						  <option value="<?php echo $row2['addon_id'];?>"><?php echo $row2['addon_title'];?></option>
						  <?php
						  }
						  ?>
                          </select>
                        </div></td>
                        <td width="80"><input type="button" name="edit" value="Edit" onclick="javascript: window.location.assign('product_addon_mod.php?site_id=<?php echo $_SESSION['SITE_ID'];?>&addon_id=' + document.frm.addon_id[document.frm.addon_id.selectedIndex].value);" /></td>
                      </tr>
                    </table>
                    <table width="100%" border="0">
                      <tr>
                        <td width="140">Product</td>
                        <td colspan="2"><select name="product_id">
						 <?php
						  $q3="select * from product_master";
						  $r3=mysql_query($q3);
						  while($row3=mysql_fetch_array($r3))
						  {?>
						  <option value="<?php echo $row3['id'];?>"><?php echo $row3['product_title'];?></option>
						  <?php
						  }
						  ?>
                        </select></td>
                      </tr>
                      <tr>
                        <td>Add On Title </td>
                        <td colspan="2"><input name="addon_title" type="text" size="35" /></td>
                      </tr>
                      <tr>
                        <td>Addon Description </td>
                        <td colspan="2"><textarea name="addon_desc" cols="30" rows="5"></textarea></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td>Upto Items </td>
                        <td>Increase/ Item </td>
                      </tr>
                      <tr>
                        <td>Price Slot 1 ( 1- </td>
                        <td width="85"><input name="slot1" type="text" size="10" /></td>
                        <td width="736">$
                        <input name="pr_inc1" type="text" size="10" /></td>
                      </tr>
                      <tr>
                        <td>Price Slot 2 </td>
                        <td><input name="slot2" type="text" size="10" /></td>
                        <td>$
                        <input name="pr_inc2" type="text" size="10" /></td>
                      </tr>
                      <tr>
                        <td>Price Slot 3 </td>
                        <td><input name="slot3" type="text" size="10" /></td>
                        <td>$
                        <input name="pr_inc3" type="text" size="10" /></td>
                      </tr>
                      <tr>
                        <td>Price Slot 4 </td>
                        <td><input name="slot4" type="text" size="10" /></td>
                        <td>$
                        <input name="pr_inc4" type="text" size="10" /></td>
                      </tr>
                      <tr>
                        <td>Price Slot 5 </td>
                        <td><input name="slot5" type="text" size="10" /></td>
                        <td>$
                        <input name="pr_inc5" type="text" size="10" /></td>
                      </tr>
                      <tr>
                        <td>Price Slot 6 </td>
                        <td><input name="slot6" type="text" size="10" /></td>
                        <td>$
                        <input name="pr_inc6" type="text" size="10" /></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td colspan="2"><input type="submit" name="action" value="Save" /></td>
                      </tr>
</table>
</form>
                    <?php include_once('king_foot.php');?>